
$(function(){
    //1.注册 封面点击时间
    $(window.document).on("click",".tom_show_image,.show_image",function(){
        var imgSrc = $(this).attr("src");
        var accessSrc = "";
        var pos = imgSrc.indexOf("?")
        if(pos == -1){
            pos = imgSrc.indexOf("@")
        }
        if(pos == -1){
            accessSrc = imgSrc;
        }else{
            accessSrc = imgSrc.slice(0,pos);
        }
        console.log(accessSrc)
        var content = "<div style='text-align: center;line-height: 637px;'><img style='max-height: 550px;max-width: 800px;' id='show_image_dialog' src='"+accessSrc+"'/></div>"
        layui.layer.open({
            type: 1,
            area: ['1000px', '680px'], //宽高
            content: content,
            skin:"layui-layer-molv",
            title:"大图显示",
            shadeClose:true,
            success:function(){
            }

        });
    });
    //2.全局时间 输入框 输入字数限制
    $(document).on("keyup",".tom_input",function(){
        var container = $(this).closest(".layui-form-item,.tom_input_limit_container");
        var curInputEle = container.find(".tom_cur_input");
        if( curInputEle.length === 0 ){
            return;
        }
        curInputEle.text($(this).val().length)
    });
    $(document).on("click",".tom_play_video",function(){
        var playHtml = $(this).attr("play_html");
        var newHtml = '<script src="'+playHtml+'"><\/script>';
        layui.layer.open({
            type: 1,
            // skin: 'layui-layer-rim', //加上边框
            area: ['600px', '500px'], //宽高
            title:"视频播放",
            content: newHtml,
            shadeClose:true,
        });
    });
})